#include<bits/stdc++.h>
using namespace std;

void solve(){
	int a,b;
	cin>>a>>b;
	if (a==b){
		cout<<0<<endl;
	}else{
		int ci=0;
		int x=a;
		while(x){
			x>>=1;
			ci++;
		}
		int y=(1<<ci)-1;
		if (b>y){
			cout<<"-1"<<endl;
		}else{
			cout<<2<<endl;
			cout<<y-a<<" "<<y-b<<endl;
		}
		
	}
}
int main(){
	int t;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}
